package interpreter;
import java.math.BigDecimal;


public class ExprSeq extends Expr{
	
	private Expr[] seq;
	
	private ExprSeq (Expr... seq) throws Exception{
		if(seq.length == 0)
			throw new Exception("Sequence length = 0");
		this.seq = seq;
	}
	
	public static Expr _(Expr... seq) throws Exception{
		return new ExprSeq(seq);
	}

	@Override
	protected BigDecimal evaluate(Env env) throws Exception{
		for (int i=0; i<seq.length-1; i++){
			seq[i].evaluate(env);
		}
		return seq[seq.length-1].evaluate(env);
	}

}
